#ifndef PROJECT_H
#define PROJECT_H

#include <QWidget>
#include "blldataflow.h"
#include "sqlhelper.h"
#include "ettadatastruct.h"
#include "appinit.h"
#include "bllcontroller.h"

namespace Ui {
class Project;
}

class Project : public QWidget
{
    Q_OBJECT

public:
    //单例模式,保证一个程序只存在一个project实例对象
    static Project *Instance();
    explicit Project(QWidget *parent = nullptr);
    ~Project();

    void show();
    void bringToFront();

private slots:
    void changeMainPageIndexSlot(int index);
    void returnLastMainPageSlot();
    void retranslateUiSlot();

protected:
    void closeEvent(QCloseEvent *);
    void paintEvent(QPaintEvent *);

private:
    void initWidget();
    void setStyle(QString qssFile);
    void drawStartupHeader();
    void drawLoginHeader();
    void drawMainUiHeader();
    void drawSubPageHeader();

private:
    static Project *self;
    Ui::Project *ui;
    BllDataFlow * bdf;
    SqlHelper * sqlHelper;
    AppInit * appInit;
    BllController * bCtrl;
    QString m_headerStyleSheet;
    int lastIndex;
};

#endif // PROJECT_H
